<?php

namespace app\admin\controller;

use app\admin\service\PoliceCenterService;

/**
 *
 * 报警中心-BI大屏-控制器
 * Class DeviceBind
 */
class PoliceCenter extends Backend
{
    public function initialize()
    {
        parent::initialize();
        $this->service = new PoliceCenterService($this->request->get('schoole_id'),$this->userId);
    }

    /**
     * 获取学校报警概况
     * @return mixed|null
     */
    public function index()
    {
        $result = $this->service->getPoliceOverview();
        return $this->jsonReturn($result);
    }

    /**
     * 获取今日各年级未处理报警统计
     * @return mixed|null
     */
    public function getTodayUntreatedTotal()
    {
        $result = $this->service->getTodayUntreatedTotal();
        return $this->jsonReturn($result);
    }

    /**
     * 获取当日各年级报警数量分布
     * @return mixed|null
     */
    public function getTodayResortTotal()
    {
        $result = $this->service->getTodayResortTotal();
        return $this->jsonReturn($result);
    }

    /**
     * 获取各年级报警趋势
     * @return mixed|null
     */
    public function getGradeResortTrend()
    {
        $result = $this->service->getGradeResortTrend();
        return $this->jsonReturn($result);
    }

    /**
     * 获取当日各年级报警处理率
     * @return mixed|null
     */
    public function getTodayResortHandle()
    {
        $result = $this->service->getTodayResortHandle();
        return $this->jsonReturn($result);
    }

    /**
     * 获取今日报警概况
     * @return null
     */
    public function getTodayResortOverview()
    {
        $result = $this->service->getTodayResortOverview();
        return $this->jsonReturn($result);
    }

    /**
     * 获取今日报警列表
     * @return null
     */
    public function getTodayResortList()
    {
        $page = $this->request->get('page', 1);
        $page_size = $this->request->get('page_size', 10);
        $result = $this->service->getTodayResortList($page, $page_size);
        return $this->jsonReturn($result);
    }

    public function test()
    {
        $result = $this->service->test();
        return $this->jsonReturn($result);
    }
}
